<nz-breadcrumb class="breadcrumb">
  <nz-breadcrumb-item>
    <a routerLink="/Home">首页</a>
  </nz-breadcrumb-item>
  <nz-breadcrumb-item>劳动合同信息列表</nz-breadcrumb-item>
</nz-breadcrumb>
<form nz-form class="search-form" [formGroup]="searchForm" (keydown.enter)="$event.preventDefault();onSearch()" nzLayout="inline">
  <nz-form-item>
    <nz-form-label nzFor="employeeName">员工姓名</nz-form-label>
    <nz-form-control>
      <nz-input-group nzSearch [nzAddOnAfter]="employeeNameSuffixIconButton">
        <input nz-input formControlName="employeeName" placeholder="请选择员工姓名" readonly />
      </nz-input-group>
      <ng-template #employeeNameSuffixIconButton>
        <button nz-button nzType="primary" nzSearch (click)="findEmployee()"><nz-icon nzType="search" /></button>
      </ng-template>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label nzFor="contractType">合同类型</nz-form-label>
    <nz-form-control>
      <nz-select formControlName="contractType" class="custom-select-width">
        <nz-option nzLabel="全职" [nzValue]="10"></nz-option>
        <nz-option nzLabel="兼职" [nzValue]="20"></nz-option>
        <nz-option nzLabel="实习" [nzValue]="30"></nz-option>
      </nz-select>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label nzFor="state">合同状态</nz-form-label>
    <nz-form-control>
      <nz-select formControlName="state" class="custom-select-width">
        <nz-option nzLabel="有效" [nzValue]="10"></nz-option>
        <nz-option nzLabel="终止" [nzValue]="20"></nz-option>
        <nz-option nzLabel="续签" [nzValue]="30"></nz-option>
      </nz-select>
    </nz-form-control>
  </nz-form-item>
  <button nz-button type="button" nzType="primary" [nzLoading]="searchLoading" (click)="onSearch()">查询</button>
  <button nz-button type="button" class="margin-button" (click)="onReset()">重置</button>
  <button nz-button type="button" class="margin-button" nzType="primary" (click)="onAdd()">新增</button>
  <button nz-button type="button" class="margin-button" nzType="primary" [nzLoading]="searchLoading" (click)="onExport()">导出</button>
</form>
<nz-table #basicTable [nzData]="listOfData" [nzTotal]="total" [nzLoading]="searchLoading" nzSize="small">
  <thead>
    <tr>
      <th>员工姓名</th>
      <th>合同签订日期</th>
      <th>合同类型</th>
      <th>生效日期</th>
      <th>到期日期</th>
      <th>合同状态</th>
      <th>工作地点</th>
      <th>工作时间</th>
      <th>岗位职责</th>
      <th nzWidth="250px">操作</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let data of basicTable.data">
      <td>{{data.employeeName}}</td>
      <td>{{data.contractSignDate}}</td>
      <td>
        <ng-container *ngIf="data.contractType === 10">全职</ng-container>
        <ng-container *ngIf="data.contractType === 20">兼职</ng-container>
        <ng-container *ngIf="data.contractType === 30">实习</ng-container>
      </td>
      <td>{{data.effectiveDate}}</td>
      <td>{{data.expiryDate}}</td>
      <td>
        <ng-container *ngIf="data.state === 10">有效</ng-container>
        <ng-container *ngIf="data.state === 20">终止</ng-container>
        <ng-container *ngIf="data.state === 30">续签</ng-container>
      </td>
      <td>{{data.workLocation}}</td>
      <td>{{data.workingHours}}</td>
      <td class="ellipsis">{{data.jobDescription}}</td>
      <td>
        <button nz-button type="button" nzType="primary" (click)="editRow(data.id)">编辑</button>
        <button nz-button type="button" nzDanger class="margin-button" (click)="delRow(data.id)">删除</button>
        <button nz-button type="button" class="margin-button" (click)="detailRow(data)">详情</button>
      </td>
    </tr>
  </tbody>
</nz-table>
<employee-selector (employeeSelectedEvent)="handleEmployeeSelectedEvent($event)"></employee-selector>
<contract-add (addedEvent)="onAdded($event)"></contract-add>
<contract-view></contract-view>
